package com.hyb.algorithm.data.struct.thread;

import java.util.concurrent.CompletableFuture;

/**
 * @author: ybhu
 * @create: 2024/01/31 11:10
 */
public class CompletableFutureDemo {

    public static void main(String[] args) {
        CompletableFuture future1=CompletableFuture.runAsync(()->{
            System.out.println("执行没有返回值的任务");
        });

        CompletableFuture<String> future2=CompletableFuture.supplyAsync(()->{
            return "执行有返回值的任务";
        });

        System.out.println(future2.join());
    }


}
